package com.cf.r1029_e;

import java.io.*;

public class d {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        in.nextToken(); int T = (int) in.nval;
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            in.nextToken(); a[i] = (long) in.nval;
        }
        boolean ans = true;
        if (a[0] == a[1]) {
            ans = check(a);
        } else if (a[0] < a[1]) {
            long cur = a[1] - a[0];
            for (int i = 0; i < n; i++) {
                a[i] -= cur * (i + 1);
            }
            ans = check(a);
        } else {
            long cur = a[n - 2] - a[n - 1];
            for (int i = 0; i < n; i++) a[i] -= cur * (n - i);
            ans = check(a);
        }
        out.println(ans ? "YES" : "NO");

    }

    static boolean check(long[] a) {
        if (a[0] < 0) return false;
        if (a[0] % (a.length + 1) != 0) return false;
        for (long j : a) {
            if (j != a[0]) return false;
        }
        return true;
    }
}
